<include file="public/head"/>
<include file="public/scripts"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<body>
<div class="wrap js-check-wrap">
    <!--<ul class="nav nav-tabs">-->
        <!--<li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/index')}">微信公众号信息</a></li>-->
        <!--<li class="active"><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/reply')}">公众号管理</a></li>-->
    <!--</ul>-->
    <!--<br>-->
    <!-- <ul class="nav nav-tabs">
        <li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/reply')}">回复消息</a></li>
        <li <if condition="!isset($name)">class="active"</if> ><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/menu')}?id=0">自定义菜单</a></li>
        <li <if condition="isset($name)">class="active"</if>><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/menu_list')}">个性义菜单</a></li>
    </ul>
    <br> -->
    <ul class="nav nav-tabs">
        <li><a href="{:cmf_plugin_url('QbtWxOs://AdminIndex/menu')}">自定义菜单列表</a></li>
        <li class="active"><a href="javascript:;">编辑菜单栏</a></li>
    </ul>

    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:cmf_plugin_url('QbtWxOs://AdminIndex/edit_menu_action')}">
        <div class="form-group">
            <label for="input-parent_id" class="col-sm-2 control-label"><span class="form-required">*</span>上级</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" name="p_id" id="input-parent_id">

                    <option value="0" <if condition="$info.p_id eq 0">selected="selected" </if>>作为一级菜单</option>
                    <foreach name="list" item="vo">
                        <option value="{$vo.id}" <if condition="$info.p_id eq $vo.id">selected="selected" </if>>&nbsp;&nbsp;&nbsp;&nbsp;{$vo.menu_name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <input type="hidden" name="id" value="{$info.id}">
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>菜单名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="menu_name" value="{$info.menu_name}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-app" class="col-sm-2 control-label"><span class="form-required">*</span>菜单类型</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" name="name_type" id="input-parent_id">
                    <foreach name="arr" item="vo">
                        <option value="{$vo.type}" <if condition="$info.name_type eq $vo.type">selected='selected' </if>>{$vo.name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <script>
            $('.form-control').change(function(){
                var type = $(this).val();
                console.log(type);
                if(type == 1){
                    $('#click').show();
                    $('#wz').show();
                    $('#click1').show();
                    $('#click23').show();
                    $('#view').hide();
                }else if(type == 2){
                    $('#click').hide();
                    $('#click1').hide();
                    $('#wz').hide();
                    $('#click23').hide();
                    $('#view').show();
                }
            })
        </script>




        <div class="form-group" id="click" <if condition="$info.name_type neq 1">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">KEY</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-controller" name="key" value="{$info.key}"  placeholder="当该菜单为最后一级菜单时，key为必填">
            </div>
        </div>
        <div class="form-group" id="click23" <if condition="$info.name_type neq 1">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">所属类型：</label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" name="type" <if condition="$info.type eq 1"> checked="checked" </if> value="1" >文字 &nbsp;
                <input type="radio" name="type" <if condition="$info.type eq 2"> checked="checked" </if> value="2" >图片 &nbsp;
                <input type="radio" name="type" <if condition="$info.type eq 3"> checked="checked" </if> value="3" >图文
            </div>
        </div>
        <script>
            $("input").click(function () {
                var val = $('input:radio[name="type"]:checked').val();
                if(val == 1){
                    $('#wz').show();
                    $('#tp').hide();
                    $('.tw').hide();
                }else if(val == 2){
                    $('#wz').hide();
                    $('#tp').show();
                    $('.tw').hide();
                }else if(val == 3){
                    $('#wz').hide();
                    $('#tp').hide();
                    $('.tw').show();
                }
            })
        </script>

<div class="form-group" id="wz" <if condition="($info.type neq 1) OR ($info.type eq 0 )">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">文字</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-controller" name="content" <if condition="$info.type eq 1">value="{$info.content}"</if> >
            </div>
        </div>
        <div class="form-group" id="tp" <if condition="$info.type neq 2">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">图片</label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="img_url" <if condition="$info.type eq 2">value="{$info.content.img_url}"</if>>
                <input id="photo-1-name" type="text" name="img_name" title="图片名称" <if condition="$info.type eq 2">value="{$info.content.img_name}"</if>>
                <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a><span style="color: #42454A">(建议尺寸：750*350像素)</span>
                <img <if condition="$info.type eq 2">src="{:cmf_get_image_url($info.content.img_url)}"</if> id="photo-1-preview" width="300px" >
            </div>
        </div>
        <div class="form-group tw" <if condition="$info.type neq 3">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">标题</label>
            <div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-controller" name="title" <if condition="$info.type eq 3"> value="{$info.content.title}" </if>>
            </div>
        </div>
        <div class="form-group tw"  <if condition="$info.type neq 3">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">描述</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-controller" name="desc" <if condition="$info.type eq 3">value="{$info.content.desc}"</if>>
            </div>
        </div>
        <div class="form-group tw"  <if condition="$info.type neq 3">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">跳转url</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-controller" name="tz_url" <if condition="$info.type eq 3">value="{$info.content.tz_url}"</if>>
            </div>
        </div>
        <div class="form-group tw"  <if condition="$info.type neq 3">style="display: none" </if>>
            <label for="input-controller" class="col-sm-2 control-label">图片</label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-2" type="hidden" name="img_url1" <if condition="$info.type eq 3">value="{$info.content.img_url1}"</if>>
                <input id="photo-2-name" type="text" name="img_name1" title="图片名称" <if condition="$info.type eq 3">value="{$info.content.img_name1}"</if>>
                <a href="javascript:uploadOneImage('图片上传','#photo-2');">上传</a><span style="color: #42454A">(建议尺寸：750*350像素)</span>
                <img id="photo-2-preview" width="300px" <if condition="$info.type eq 3">src="{:cmf_get_image_url($info.content.img_url1)}"</if>>
            </div>
        </div>

        <div class="form-group" id="view"  <if condition="$info.name_type neq 2 ">style="display: none" </if>>
            <label for="input-action" class="col-sm-2 control-label"><span class="form-required">*</span>url</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-action" name="url" value="{$info.url}">
            </div>
        </div>



        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
</body>
</html>
